import { CURRENT_ACTIVITY_INFO } from '@/store/mutation-types'
import { IAsyncRouteState } from './state'
import { Storage } from '@/utils/storage'

export const mutations = {
  setRouters: (state: IAsyncRouteState, routers): void => {
    // 设置动态路由
    state.menus = routers
  },
  setCurActive: (state, curActive): void => {
    state.curActive = curActive
    Storage.set(CURRENT_ACTIVITY_INFO, curActive)
  },
  setKeepAliveComponents: (state: IAsyncRouteState, compNames): void => {
    // 设置需要缓存的组件
    state.keepAliveComponents = compNames
  }
}
